/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg_entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Oswaldo
 */
@Entity
@Table(name = "ssuc_sucursal", catalog = "sisventas_db", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sucursal.findAll", query = "SELECT s FROM Sucursal s"),
    @NamedQuery(name = "Sucursal.findBySucCodigo", query = "SELECT s FROM Sucursal s WHERE s.sucCodigo = :sucCodigo"),
    @NamedQuery(name = "Sucursal.findBySucDireccion", query = "SELECT s FROM Sucursal s WHERE s.sucDireccion = :sucDireccion"),
    @NamedQuery(name = "Sucursal.findBySucTelefon1", query = "SELECT s FROM Sucursal s WHERE s.sucTelefon1 = :sucTelefon1"),
    @NamedQuery(name = "Sucursal.findBySucTelefon2", query = "SELECT s FROM Sucursal s WHERE s.sucTelefon2 = :sucTelefon2"),
    @NamedQuery(name = "Sucursal.findBySucCelular1", query = "SELECT s FROM Sucursal s WHERE s.sucCelular1 = :sucCelular1"),
    @NamedQuery(name = "Sucursal.findBySucCelular2", query = "SELECT s FROM Sucursal s WHERE s.sucCelular2 = :sucCelular2"),
    @NamedQuery(name = "Sucursal.findBySucTipo", query = "SELECT s FROM Sucursal s WHERE s.sucTipo = :sucTipo")})
public class Sucursal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "suc_codigo")
    private Integer sucCodigo;
    @Size(max = 100)
    @Column(name = "suc_direccion")
    private String sucDireccion;
    @Size(max = 15)
    @Column(name = "suc_telefon1")
    private String sucTelefon1;
    @Size(max = 15)
    @Column(name = "suc_telefon2")
    private String sucTelefon2;
    @Size(max = 11)
    @Column(name = "suc_celular1")
    private String sucCelular1;
    @Size(max = 11)
    @Column(name = "suc_celular2")
    private String sucCelular2;
    @Column(name = "suc_tipo")
    private Character sucTipo;
    @JoinColumn(name = "usr_codigo", referencedColumnName = "usr_codigo")
    @ManyToOne
    private Usuario usrCodigo;
    @JoinColumn(name = "loc_codigo", referencedColumnName = "loc_codigo")
    @ManyToOne
    private Localiza locCodigo;

    public Sucursal() {
    }

    public Sucursal(Integer sucCodigo) {
        this.sucCodigo = sucCodigo;
    }

    public Integer getSucCodigo() {
        return sucCodigo;
    }

    public void setSucCodigo(Integer sucCodigo) {
        this.sucCodigo = sucCodigo;
    }

    public String getSucDireccion() {
        return sucDireccion;
    }

    public void setSucDireccion(String sucDireccion) {
        this.sucDireccion = sucDireccion;
    }

    public String getSucTelefon1() {
        return sucTelefon1;
    }

    public void setSucTelefon1(String sucTelefon1) {
        this.sucTelefon1 = sucTelefon1;
    }

    public String getSucTelefon2() {
        return sucTelefon2;
    }

    public void setSucTelefon2(String sucTelefon2) {
        this.sucTelefon2 = sucTelefon2;
    }

    public String getSucCelular1() {
        return sucCelular1;
    }

    public void setSucCelular1(String sucCelular1) {
        this.sucCelular1 = sucCelular1;
    }

    public String getSucCelular2() {
        return sucCelular2;
    }

    public void setSucCelular2(String sucCelular2) {
        this.sucCelular2 = sucCelular2;
    }

    public Character getSucTipo() {
        return sucTipo;
    }

    public void setSucTipo(Character sucTipo) {
        this.sucTipo = sucTipo;
    }

    public Usuario getUsrCodigo() {
        return usrCodigo;
    }

    public void setUsrCodigo(Usuario usrCodigo) {
        this.usrCodigo = usrCodigo;
    }

    public Localiza getLocCodigo() {
        return locCodigo;
    }

    public void setLocCodigo(Localiza locCodigo) {
        this.locCodigo = locCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sucCodigo != null ? sucCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sucursal)) {
            return false;
        }
        Sucursal other = (Sucursal) object;
        if ((this.sucCodigo == null && other.sucCodigo != null) || (this.sucCodigo != null && !this.sucCodigo.equals(other.sucCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pkg_entidades.Sucursal[ sucCodigo=" + sucCodigo + " ]";
    }
    
}
